package com.hanrui.android.activity.message.audit;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

import com.hanrui.android.R;
import com.hanrui.android.library.base.ActionBarBaseActivity;
import com.hanrui.android.model.NoticeDetailBean;
import com.hanrui.android.net.contract.message.audit.NoticeDetailContract;
import com.hanrui.android.net.presenter.message.audit.NoticeDetailPresenter;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 通知详情
 */
public class NoticeDetailActivity extends ActionBarBaseActivity<NoticeDetailPresenter> implements NoticeDetailContract.View {
    @BindView(R.id.main_title)
    TextView mainTitle;
    @BindView(R.id.subhead_title)
    TextView subHeadTitle;
    @BindView(R.id.name)
    TextView name;
    @BindView(R.id.work_content)
    TextView workContent;
    @BindView(R.id.carry)
    TextView carry;

    String nid;


    @Override
    protected void initInjector() {mActivityComponent.inject(this);

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_noticedetail);

        mTitleBar.setTitle("通知公告");

        unbinder = ButterKnife.bind(this);

        nid = getIntent().getStringExtra("nid");

        mPresenter.detail(this,nid);
    }

    @Override
    public void detail(NoticeDetailBean data) {

        if (null != data) {

            mainTitle.setText(data.getNotice().getTitle());
            subHeadTitle.setText(data.getNotice().getCreateDate());
            name.setText(data.getNotice().getOfficeName());
            workContent.setText(data.getNotice().getContent());
            carry.setText(data.getNotice().getRemarks());


        		}

    }

    public static void start(Context context,String nid){
        Intent intent = new Intent(context,NoticeDetailActivity.class);
        intent.putExtra("nid",nid);
        context.startActivity(intent);
    }
}
